package com.zyt.mapper;

import com.zyt.pojo.Student;
import com.zyt.pojo.StudentQueryParam;
import com.zyt.pojo.clazzOption;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {
/*
 * @Description:分页查询
 */
    List<Student> rows(StudentQueryParam studentQueryParam);
/*
* @Description:批量删除
 */
    void deleteByIds(List<Integer> ids);
/*
* @Description:增加学员
 */
    void insert(Student student);
/*
* @Description:根据id查询
 */
    Student getById(Integer id);
/*
* @Description:修改学员信息
 */
    void update(Student student);
/*
* @Description:学员违纪
 */
    void violation(Integer id, Integer score);
    /*
    * @Description:学员学历统计
     */
    @MapKey("pos")
  List<Map> countStudentDegreeData();
    /*
    * @Description:学员数量统计
     */
    @Select("select c.name cname , count(s.id) scount from clazz c  left join student s on s.clazz_id = c.id group by c.name order by count(s.id) desc ")
    List<Map<String,Object>> countStudentCountData();
}
